<?php

class Pldkp_Form_Element_MultiSelector extends ZendX_JQuery_Form_Element_UiWidget
{
    protected $_element = null;
    
    public $helper = "multiSelector";
    
    protected $_isArray = true;
    
    public function __construct($spec = null, $options = null)
    {
        parent::__construct($spec, $options);
        $this->_element = new Zend_Form_Element_Multiselect('_i_am_not_used');
    }
    
    /**
     * And this apperntly is the way to hack the options into the view helper....
     * ZendX JQuery can be quite annoying ...
     * 
     * return array
     */
    public function getAttribs()
    {
        $attribs = parent::getAttribs();
        $attribs['options'] = $this->getMultiOptions();
        return $attribs;
    }
    
    /**
     * return bool 
     */
    public function isValid($value)
    {
        return parent::isValid($value) && $this->_element->isValid($value);
    }
    
    public function clearMultiOptions()
    {
        return $this->_element->clearMultiOptions();
    }
    
    public function addMultiOption(string $option, string $value)
    {
        return $this->_element->addMultiOption($option, $value);
    }
    
    public function addMultiOptions(array $options)
    {
        return $this->_element->addMultiOptions($options);
    }
    
    public function setMultiOptions(array $options)
    {
        return $this->_element->setMultiOptions($options);
    }
    
    public function getMultiOption(string $option)
    {
        return $this->_element->getMultiOption($option);
    }
    
    public function getMultiOptions()
    {
        return $this->_element->getMultiOptions();
    }
    
    
}